import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import Home1 from '../pages/home/index.vue';
import Drinkmanage from '../pages/drinkmanage/index.vue';
import Ordermanage from '../pages/ordermanage/index.vue';
import Vipmanage from '../pages/vipmanage/index.vue';
import Drinkmeaus from '../pages/drinkmeaus/index.vue';
import Drinklush from '../pages/drinklush/index.vue';
import System from '../pages/system/index.vue';
import Main from '../pages/main/index.vue';
import Login from '../pages/login.vue'
Vue.use(VueRouter)
// 重复点击
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
const routes = [
	// {
	//   path: '/about',
	//   name: 'About',
	//   // route level code-splitting
	//   // this generates a separate chunk (about.[hash].js) for this route
	//   // which is lazy-loaded when the route is visited.
	//   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
	// },
	{
		path: "/",
		name: "root",
		meta: { hidden: true },
		redirect: '/login'
	},
	{
		path: '/login',
		component: Login,
		meta: { hidden: true },
	},
	{
		path: "/main",
		meta: { hidden: true, titleNav: true },
		component: Main,
		children: [
			{
				path: "/home",
				name: "主页",
				meta: { nowIndex: 0, isNav: true, icon: 'iconfont icon-zhuye' },
				component: Home1
			},
			{
				path: "/ordermanage",
				name: "订单管理",
				meta: { nowIndex: 1, isNav: true, icon: 'iconfont icon-dingdanguanli' },
				component: Ordermanage
			},
			{
				path: "/drinkmanage",
				name: "饮品管理",
				meta: { nowIndex: 2, isNav: true, icon: 'iconfont icon-yinpinyinliao', isChild: true },
				component: Drinkmanage,
				children: [
					{
						path: "/drinkmanage/drinklush",
						name: "饮品库存",
						meta: { nowIndex: 2, index: 0, },
						component: Drinklush
					},
					{
						path: "/drinkmanage/drinkmeaus",
						name: "饮品资料",
						meta: { nowIndex: 2, index: 1, },
						component: Drinkmeaus
					},
				]
			},
			{
				path: "/vipmanage",
				name: "会员管理",
				meta: { nowIndex: 3, isNav: true, icon: 'iconfont icon-huiyuanguanli-copy' },
				component: Vipmanage
			},
			{
				path: "/system",
				name: "系统设置",
				meta: { nowIndex: 4, isNav: true, icon: 'iconfont icon-xitongshezhi' },
				component: System
			}
		]
	},

]

const router = new VueRouter({
	routes
})

export default router
